#!/bin/bash

PROJECT_DIR=$(pwd)

# refresh build folder
cd ${PROJECT_DIR}
if [ -d build_case ]; then
    rm -rf build_case
fi
mkdir build_case

# build
echo "[INFO] Building in ${PROJECT_DIR}/build_case/"
cd ${PROJECT_DIR}/build_case/
cmake ../
make -j4

# run vector_add example
echo "[INFO] Running vector_add example..."
cd ${PROJECT_DIR}/build_case/bin/
chmod +x vector_add
./vector_add

# return to project dir
cd ${PROJECT_DIR}   
echo "[INFO] All finished."